package org.peterf.foxish.activity;

import org.peterf.foxish.R;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

/**
 * The default {@link Activity} that shows the debug information.
 * <p>
 * Pass in the information with the name specified by
 * foxish_bug_report_activity_param in resources.
 * <p>
 * This activity always returns {@link Activity#RESULT_OK}.
 * 
 * @author peter
 * 
 */
public class BugReportActivity extends Activity {

    public static final String PARAMETER_NAME = "org.peterf.foxish.Error";

    /**
     * Pass in the information with the name specified by
     * {@link #PARAMETER_NAME}.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!getIntent().hasExtra(PARAMETER_NAME)) {
            finish();
            return;
        }
        setContentView(R.layout.bug_report_activity);
        TextView view = (TextView) findViewById(R.id.foxish_bug_report_activity_stacktrace);
        view.setText(getIntent().getStringExtra(PARAMETER_NAME));
        setResult(RESULT_OK);
    }

}
